<div class="account-token-section">
	<div class="account-token-header">
		<div class="account-token-barcode">
		<?php Yii::app()->codeManager->barCode($model); ?>
		</div>
		<div class="account-token-date">日期： <?php echo $model->tokenDate; ?></div>
		<div class="account-token-title">
		记账凭证
		</div>
	</div>
	<div class="clear"></div>
	<div class="account-token-body">
	<div class="account-token-side">
		<div>附单据数</div>
		<div class="account-token-side-transform" style="width:110px;margin: 35px 0 47px -51px;">（　　　　　　）</div>
		<div>张</div>
		<div class="account-token-side-transform account-token-notice" style="width:212px;margin: 92px 0 0 -103px; line-height: 12px;">
		四川建祥建筑工程有限公司记账凭证 <span class="account-token-id">#<?php echo Yii::app()->numberFormatter
															 ->format('00000000', $model->id);
														 ?></span>
		</div>
		
	</div>
	<div class="account-token-main">
	<table class="account-token-items">
		<caption>
		<?php echo $model->getProjectName(); ?>
		第 <?php echo Yii::app()->numberFormatter->format('0000', $model->number); ?> 号 
		第<?php
		 echo Yii::app()->numberFormatter->format('0000', $page);
		 ?>页 / 共<?php echo Yii::app()->numberFormatter->format('0000', $pages);
				?>页</caption>
		<thead>
		<tr><th width="25%">摘要</th><th width="45%">科目</th><th width="15%">借方</th><th width="15%">贷方</th></tr>
		</thead>
		<tbody>
		<?php
		$count = count($items);
		$i = 0;
		foreach ($items as $item) {
		?>
		<tr>
		<td><?php echo $item->summary; ?></td>
		<td><?php echo $item->category->getDisplayLongName(); ?></td>
		<td class="account-token-item-currency"><?php if ($item->debit) {
														$stat->debit = $stat->debit
															+ intval($item->debit * 100);
														echo Yii::app()->format
															->formatCurrency($item->debit);
													}
												?></td>
		<td class="account-token-item-currency"><?php if ($item->credit) {
														$stat->credit = $stat->credit
															+ intval($item->credit * 100);
														echo Yii::app()->format
															->formatCurrency($item->credit);
													}
												?></td>
		</tr>
		<?php

			$i++;
		}
		?>
		<?php while ($i < $itemPerSection) {
			$i++;
		?>
		<tr>
		<td> </td>
		<td> </td>
		<td> </td>
		<td> </td>
		</tr>
		<?php } ?>
		</tbody>
		<tfoot>
		<?php if ($page == $pages) { ?>
		<tr><td colspan="2"><?php
								if (!$model->isBalanced()) {
							?><span class="error">（未平）</span>
<?php
	} else {
?>合计：<?php
			 echo Yii::app()->format->formatCapitalCurrency($model->totalDebit);
		 }

	 ?></td>
		<td class="account-token-item-currency"><?php echo Yii::app()->format
														->formatCurrency($model->totalDebit); ?></td>
		<td class="account-token-item-currency"><?php echo Yii::app()->format
														->formatCurrency($model->totalCredit); ?></td></tr>
		<?php } else { ?>
		<tr><td colspan="2"> </td>
		<td class="account-token-item-currency"><?php echo Yii::app()->format
														->formatCurrency($stat->debit / 100); ?></td>
		<td class="account-token-item-currency"><?php echo Yii::app()->format
														->formatCurrency($stat->credit / 100); ?></td>
		</tr>
		<?php } ?>
		</tfoot>
	</table>
	</div>
	</div>
	<div class="clear"></div>
	<div class="account-token-footer">
		<div class="account-token-footer-section">记账人： </div>
		<div class="account-token-footer-section">复核人： </div>
		<div class="account-token-footer-section">制单人： <?php echo $model->createUser->employee
														   ->getFullName();
													   ?></div>
		<div class="clear"></div>
	</div>
	<div class="clear"></div>
</div>
<?php
$page = isset($overallPage) ? $overallPage->page + $page : $page;
if ($page % 2 == 0) {
?>
<div style="page-break-after:always"></div>
<?php } else { ?>
<div class="account-token-section-separator"></div>
<?php } ?>
